1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module adw.ExpanderRow;
26 
27 private import adw.PreferencesRow;
28 private import adw.c.functions;
29 public  import adw.c.types;
30 private import glib.ConstructionException;
31 private import glib.Str;
32 private import glib.c.functions;
33 private import gobject.ObjectG;
34 private import gtk.Widget;
35 
36 
37 /**
38  * A [class@Gtk.ListBoxRow] used to reveal widgets.
39  * 
40  * <picture>
41  * <source srcset="expander-row-dark.png" media="(prefers-color-scheme: dark)">
42  * <img src="expander-row.png" alt="expander-row">
43  * </picture>
44  * 
45  * The `AdwExpanderRow` widget allows the user to reveal or hide widgets below
46  * it. It also allows the user to enable the expansion of the row, allowing to
47  * disable all that the row contains.
48  * 
49  * ## AdwExpanderRow as GtkBuildable
50  * 
51  * The `AdwExpanderRow` implementation of the [iface@Gtk.Buildable] interface
52  * supports adding a child as an action widget by specifying “action” as the
53  * “type” attribute of a <child> element.
54  * 
55  * It also supports adding it as a prefix widget by specifying “prefix” as the
56  * “type” attribute of a <child> element.
57  * 
58  * ## CSS nodes
59  * 
60  * `AdwExpanderRow` has a main CSS node with name `row` and the `.expander`
61  * style class. It has the `.empty` style class when it contains no children.
62  * 
63  * It contains the subnodes `row.header` for its main embedded row,
64  * `list.nested` for the list it can expand, and `image.expander-row-arrow` for
65  * its arrow.
66  *
67  * Since: 1.0
68  */
69 public class ExpanderRow : PreferencesRow
70 {
71 	/** the main Gtk struct */
72 	protected AdwExpanderRow* adwExpanderRow;
73 
74 	/** Get the main Gtk struct */
75 	public AdwExpanderRow* getExpanderRowStruct(bool transferOwnership = false)
76 	{
77 		if (transferOwnership)
78 			ownedRef = false;
79 		return adwExpanderRow;
80 	}
81 
82 	/** the main Gtk struct as a void* */
83 	protected override void* getStruct()
84 	{
85 		return cast(void*)adwExpanderRow;
86 	}
87 
88 	/**
89 	 * Sets our main struct and passes it to the parent class.
90 	 */
91 	public this (AdwExpanderRow* adwExpanderRow, bool ownedRef = false)
92 	{
93 		this.adwExpanderRow = adwExpanderRow;
94 		super(cast(AdwPreferencesRow*)adwExpanderRow, ownedRef);
95 	}
96 
97 
98 	/** */
99 	public static GType getType()
100 	{
101 		return adw_expander_row_get_type();
102 	}
103 
104 	/**
105 	 * Creates a new `AdwExpanderRow`.
106 	 *
107 	 * Returns: the newly created `AdwExpanderRow`
108 	 *
109 	 * Since: 1.0
110 	 *
111 	 * Throws: ConstructionException GTK+ fails to create the object.
112 	 */
113 	public this()
114 	{
115 		auto __p = adw_expander_row_new();
116 
117 		if(__p is null)
118 		{
119 			throw new ConstructionException("null returned by new");
120 		}
121 
122 		this(cast(AdwExpanderRow*) __p);
123 	}
124 
125 	/**
126 	 * Adds an action widget to @self.
127 	 *
128 	 * Params:
129 	 *     widget = a widget
130 	 *
131 	 * Since: 1.0
132 	 */
133 	public void addAction(Widget widget)
134 	{
135 		adw_expander_row_add_action(adwExpanderRow, (widget is null) ? null : widget.getWidgetStruct());
136 	}
137 
138 	/**
139 	 * Adds a prefix widget to @self.
140 	 *
141 	 * Params:
142 	 *     widget = a widget
143 	 *
144 	 * Since: 1.0
145 	 */
146 	public void addPrefix(Widget widget)
147 	{
148 		adw_expander_row_add_prefix(adwExpanderRow, (widget is null) ? null : widget.getWidgetStruct());
149 	}
150 
151 	/**
152 	 * Adds a widget to @self.
153 	 *
154 	 * The widget will appear in the expanding list below @self.
155 	 *
156 	 * Params:
157 	 *     child = a widget
158 	 *
159 	 * Since: 1.0
160 	 */
161 	public void addRow(Widget child)
162 	{
163 		adw_expander_row_add_row(adwExpanderRow, (child is null) ? null : child.getWidgetStruct());
164 	}
165 
166 	/**
167 	 * Gets whether the expansion of @self is enabled.
168 	 *
169 	 * Returns: whether the expansion of @self is enabled.
170 	 *
171 	 * Since: 1.0
172 	 */
173 	public bool getEnableExpansion()
174 	{
175 		return adw_expander_row_get_enable_expansion(adwExpanderRow) != 0;
176 	}
177 
178 	/**
179 	 * Gets whether @self is expanded.
180 	 *
181 	 * Returns: whether @self is expanded
182 	 *
183 	 * Since: 1.0
184 	 */
185 	public bool getExpanded()
186 	{
187 		return adw_expander_row_get_expanded(adwExpanderRow) != 0;
188 	}
189 
190 	/**
191 	 * Gets the icon name for @self.
192 	 *
193 	 * Returns: the icon name for @self
194 	 *
195 	 * Since: 1.0
196 	 */
197 	public string getIconName()
198 	{
199 		return Str.toString(adw_expander_row_get_icon_name(adwExpanderRow));
200 	}
201 
202 	/**
203 	 * Gets whether the switch enabling the expansion of @self is visible.
204 	 *
205 	 * Returns: whether the switch enabling the expansion is visible
206 	 *
207 	 * Since: 1.0
208 	 */
209 	public bool getShowEnableSwitch()
210 	{
211 		return adw_expander_row_get_show_enable_switch(adwExpanderRow) != 0;
212 	}
213 
214 	/**
215 	 * Gets the subtitle for @self.
216 	 *
217 	 * Returns: the subtitle for @self
218 	 *
219 	 * Since: 1.0
220 	 */
221 	public string getSubtitle()
222 	{
223 		return Str.toString(adw_expander_row_get_subtitle(adwExpanderRow));
224 	}
225 
226 	/** */
227 	public void remove(Widget child)
228 	{
229 		adw_expander_row_remove(adwExpanderRow, (child is null) ? null : child.getWidgetStruct());
230 	}
231 
232 	/**
233 	 * Sets whether the expansion of @self is enabled.
234 	 *
235 	 * Params:
236 	 *     enableExpansion = whether to enable the expansion
237 	 *
238 	 * Since: 1.0
239 	 */
240 	public void setEnableExpansion(bool enableExpansion)
241 	{
242 		adw_expander_row_set_enable_expansion(adwExpanderRow, enableExpansion);
243 	}
244 
245 	/**
246 	 * Sets whether @self is expanded.
247 	 *
248 	 * Params:
249 	 *     expanded = whether to expand the row
250 	 *
251 	 * Since: 1.0
252 	 */
253 	public void setExpanded(bool expanded)
254 	{
255 		adw_expander_row_set_expanded(adwExpanderRow, expanded);
256 	}
257 
258 	/**
259 	 * Sets the icon name for @self.
260 	 *
261 	 * Params:
262 	 *     iconName = the icon name
263 	 *
264 	 * Since: 1.0
265 	 */
266 	public void setIconName(string iconName)
267 	{
268 		adw_expander_row_set_icon_name(adwExpanderRow, Str.toStringz(iconName));
269 	}
270 
271 	/**
272 	 * Sets whether the switch enabling the expansion of @self is visible.
273 	 *
274 	 * Params:
275 	 *     showEnableSwitch = whether to show the switch enabling the expansion
276 	 *
277 	 * Since: 1.0
278 	 */
279 	public void setShowEnableSwitch(bool showEnableSwitch)
280 	{
281 		adw_expander_row_set_show_enable_switch(adwExpanderRow, showEnableSwitch);
282 	}
283 
284 	/**
285 	 * Sets the subtitle for @self.
286 	 *
287 	 * Params:
288 	 *     subtitle = the subtitle
289 	 *
290 	 * Since: 1.0
291 	 */
292 	public void setSubtitle(string subtitle)
293 	{
294 		adw_expander_row_set_subtitle(adwExpanderRow, Str.toStringz(subtitle));
295 	}
296 }